package xin.infinite.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xin.infinite.service.CodeService;


@RestController
@Api("验证码")
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private CodeService codeService;

    @RequestMapping("/create/{email}")
    @ApiOperation("生成验证码")
    public boolean create(@PathVariable String email){

        return codeService.create(email);
    }

    @RequestMapping("/isCorrect/{email}/{code}")
    @ApiOperation("验证码是否正确")
    public int  isCorrect(@PathVariable String email,@PathVariable String code){
        return codeService.isCorrect(email,code);
    }
}
